package com.demo.web;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.ArrayList;
import java.util.Random;

@SpringBootApplication
@Slf4j
public class StackOverFlowOOM {

    public static int num = 0;

    public static void main(String[] args) {
        // 运行本程序之前请先设置VM Options
        // -Xss100k 调整栈深度
        // Exception in thread "main" java.lang.StackOverflowError

        while (true) {
            stackOverFlow();
        }

    }

    public static void stackOverFlow() {
        num ++;
        System.out.println(num);
        stackOverFlow();
    }

}
